import Dialog from '../miniprogram_npm/@vant/weapp/dialog/dialog';
import Notify from '../miniprogram_npm/@vant/weapp/notify/notify';

export const TipAlert = ({ title, message, ok = () => {}}) => {
    Dialog.alert({
        title,
        message,
      }).then(() => {
        ok && ok();
      });
};

export const TipDialog = ({ title, message, ok = () => {}, cancel = () => {}, ...params }) => {
    Dialog.confirm({
        title,
        message,
        ...params,
    })
    .then(() => {
        ok && ok();
    })
    .catch(() => {
        cancel && cancel();
    });
};

export const TipNotice = ({ type = 'primary', top = '45vh', background = 'rgba(0, 0, 0, 0.6)',  message, ...params} ) => {
    Notify({ type, top, background, message, ...params });
};